using System;
using System.ComponentModel;

namespace teavch.Utilities.Electrical.Design.Gui.LineDiagram
{

	public partial class Busbar : ElectricalSymbol
	{

		public Busbar()
		{
			InitializeComponent();
			this.SymbolSize = 100;
			this.BorderWidth = 1;
		}

		protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
		{
			base.OnPaint(e);
			this.Paint(e);
		}

		protected override void OnResize(EventArgs e)
		{
			base.OnResize(e);
			ResizeNow(e);
		}

		private void ResizeNow(EventArgs ea)
		{
			this.Refresh();
		}

		private new void Paint( System.Windows.Forms.PaintEventArgs pea )
		{
			int _x1 = 0, _x2 = 0;
			int _y1 = 0;
			_x2 = this.SymbolSize;
			this.Width = this.SymbolSize;
			this.Height = this.BorderWidth;
			System.Drawing.Drawing2D.GraphicsPath _gpath = new System.Drawing.Drawing2D.GraphicsPath();
			if (this.BorderWidth > 1)
				_gpath.AddRectangle(new System.Drawing.Rectangle(_x1, _y1, this.SymbolSize, this.BorderWidth));
			else
				_gpath.AddLine(_x1, _x1, _x2, _x1);

			pea.Graphics.FillPath(this.Brush, _gpath);
			pea.Graphics.DrawPath( this.Pen, _gpath );
		}

	}
}
